import request from "@/utils/request";

//搜索售货机(售货机列表)
export const getsearchList = ({ pageIndex, pageSize }) => request({
  method: 'get',
  url: "/api/vm-service/vm/search",
  params: {
    pageIndex,
    pageSize
  }
})

// 点位搜索 新增的按钮要获取的数据
export const getadd = ({ pageIndex, pageSize }) => request({
  method: 'get',
  url: "/api/vm-service/node/search",
  params: {
    pageIndex,
    pageSize
  }
})

// 售货机类型列表(搜索)
export const getaddxinghao = ({ pageIndex, pageSize }) => request({
  method: 'get',
  url: "/api/vm-service/vmType/search",
  params: {
    pageIndex,
    pageSize
  }
})

//新增售货机

export const addshouhuoji = ({ vmType, nodeId, createUserId }) => request({
  method: 'post',
  url: "/api/vm-service/vm",
  data: {
    vmType,
    nodeId,
    createUserId
  }
})

//策略列表
export const getgamedata = () => request({
  method: 'get',
  url: "/api/vm-service/policy",
})


// 应用策略
export const GetApplyPolicy = (data) => request({
  method: 'put',
  url: "/api/vm-service/vm/applyPolicy",
  data
})

//查询售货机策略
export const GetApplyPolicyData = (data) => request({
  method: 'get',
  url: `/api/vm-service/policy/vmPolicy/${data}`,

})

// 取消策略
export const delApplyPolicyData = (data) => request({
  method: 'put',
  url: `/api/vm-service/vm/cancelPolicy/${data.data}/${data.policyId}`,

})


//修改售货机点位
export const updataPolicyData = ({ nodeId, id }) => request({
  method: 'put',
  url: `/api/vm-service/vm/${id}/${nodeId}`,

})

// 获取货道详情
export const getCarglaneDetail = (data) => request({
  method: 'get',
  url: `/api/vm-service/channel/channelList/${data.innerCode}`,

})

// 修改货道配置
export const AlterCarglaneDetail = (data) => request({
  method: 'put',
  url: `/api/vm-service/channel/channelConfig`,
  data
})

//商圈列表
export const businessType  = ({num}) => request({
  method: 'get',
  url: `/api/vm-service/businessType/name/${num}`,

})

// 获取商圈下销量前10的商品(补货推荐)

export const getTop10  = ({num}) => request({
  method: 'get',
  url: `/api/vm-service/sku/businessTop10/${num}`,

})

//商品搜索
export const getshopSearch  = ({pageSize,pageIndex,skuName=""}) => request({
  method: 'get',
  url: `/api/vm-service/sku/search`,
  params:{
    pageSize,
    pageIndex,
    skuName
  }
})

